<script>
import { log } from "@/utils/utils"
import { mapActions } from "vuex"
const systemInfo = uni.getSystemInfoSync()
export default {
  async onLaunch(options) {
    this.init()
    this.initApp(options)
  },
  onError(err) {
    this.handleSubmitError(err)
  },
  onShow() {
    // #ifdef MP-WEIXIN
    // 检测小程序更新
    this.$checkWxMpUpdate()
    // #endif
  },
  methods: {
    init() {
      const systemInfo = uni.getSystemInfoSync()
      // #ifdef WEB
      log("构建时间", process.env.BUILD_TIME)
      // #endif
      // #ifdef MP-WEIXIN
      systemInfo.wxEnv = uni.getAccountInfoSync()?.miniProgram.envVersion
      systemInfo.wxVersion = uni.getAccountInfoSync()?.miniProgram.version
      // #endif
      uni.$systemInfo = systemInfo

      uni.hideTabBar()
    },
    handleSubmitError(error) {
      this.errorLog({ device: JSON.stringify(systemInfo), content: `[客户端错误] ${error.toString()}`, route: uni.$currentRoute })
    },
    ...mapActions(["initApp", "errorLog"])
  }
}
</script>

<style lang="scss">
/*每个页面公共css */
@import "@/uni_modules/uview-ui/index.scss";
@import "styles/fast.scss";
@import "styles/reset.scss";
@import "styles/global.scss";
@import "styles/uview.theme.scss";
@import "zuimei/styles/index.scss";
</style>
